home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / quicktime / basics / mfc simpleedit.win / simpleeditmfc.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-23  |  3.9 KB  |  154 lines

  1. // SimpleEdit MFC.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "SimpleEditMFC.h"
  6.  
  7. #include "MainFrm.h"
  8. #include "SimpleEditMFCDoc.h"
  9. #include "SimpleEditMFCView.h"
  10. #include "QTML.h"
  11.  
  12. #ifdef _DEBUG
  13. #define new DEBUG_NEW
  14. #undef THIS_FILE
  15. static char THIS_FILE[] = __FILE__;
  16. #endif
  17.  
  18.  
  19. /////////////////////////////////////////////////////////////////////////////
  20. // CSimpleEditMFCApp
  21.  
  22. BEGIN_MESSAGE_MAP(CSimpleEditMFCApp, CWinApp)
  23.     //{{AFX_MSG_MAP(CSimpleEditMFCApp)
  24.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  25.         // NOTE - the ClassWizard will add and remove mapping macros here.
  26.         //    DO NOT EDIT what you see in these blocks of generated code!
  27.     //}}AFX_MSG_MAP
  28.     // Standard file based document commands
  29.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  30.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  31. END_MESSAGE_MAP()
  32.  
  33. /////////////////////////////////////////////////////////////////////////////
  34. // CSimpleEditMFCApp construction
  35.  
  36. CSimpleEditMFCApp::CSimpleEditMFCApp()
  37. {
  38.     // TODO: add construction code here,
  39.     // Place all significant initialization in InitInstance
  40. }
  41.  
  42. /////////////////////////////////////////////////////////////////////////////
  43. // The one and only CSimpleEditMFCApp object
  44.  
  45. CSimpleEditMFCApp theApp;
  46.  
  47. /////////////////////////////////////////////////////////////////////////////
  48. // CSimpleEditMFCApp initialization
  49.  
  50. BOOL CSimpleEditMFCApp::InitInstance()
  51. {
  52.     // Standard initialization
  53.     // If you are not using these features and wish to reduce the size
  54.     //  of your final executable, you should remove from the following
  55.     //  the specific initialization routines you do not need.
  56.  
  57.     // Initialize QTML and QuickTime
  58.     InitializeQTML(0);
  59.     EnterMovies();
  60.  
  61.  
  62. #ifdef _AFXDLL
  63.     Enable3dControls();            // Call this when using MFC in a shared DLL
  64. #else
  65.     Enable3dControlsStatic();    // Call this when linking to MFC statically
  66. #endif
  67.  
  68.     LoadStdProfileSettings(0);  // Load standard INI file options (including MRU)
  69.  
  70.     // Register the application's document templates.  Document templates
  71.     //  serve as the connection between documents, frame windows and views.
  72.  
  73.     CSingleDocTemplate* pDocTemplate;
  74.     pDocTemplate = new CSingleDocTemplate(
  75.         IDR_MAINFRAME,
  76.         RUNTIME_CLASS(CSimpleEditMFCDoc),
  77.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  78.         RUNTIME_CLASS(CSimpleEditMFCView));
  79.     AddDocTemplate(pDocTemplate);
  80.  
  81.     // Parse command line for standard shell commands, DDE, file open
  82.     CCommandLineInfo cmdInfo;
  83.     ParseCommandLine(cmdInfo);
  84.  
  85.     // Dispatch commands specified on the command line
  86.     if (!ProcessShellCommand(cmdInfo))
  87.         return FALSE;
  88.  
  89.     return TRUE;
  90. }
  91.  
  92. int CSimpleEditMFCApp::ExitInstance() 
  93. {
  94.     // Exit QuickTime and terminate QTML
  95.     ExitMovies();
  96.     TerminateQTML();
  97.     return CWinApp::ExitInstance();
  98. }
  99.  
  100.  
  101. /////////////////////////////////////////////////////////////////////////////
  102. // CAboutDlg dialog used for App About
  103.  
  104. class CAboutDlg : public CDialog
  105. {
  106. public:
  107.     CAboutDlg();
  108.  
  109. // Dialog Data
  110.     //{{AFX_DATA(CAboutDlg)
  111.     enum { IDD = IDD_ABOUTBOX };
  112.     //}}AFX_DATA
  113.  
  114.     // ClassWizard generated virtual function overrides
  115.     //{{AFX_VIRTUAL(CAboutDlg)
  116.     protected:
  117.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  118.     //}}AFX_VIRTUAL
  119.  
  120. // Implementation
  121. protected:
  122.     //{{AFX_MSG(CAboutDlg)
  123.         // No message handlers
  124.     //}}AFX_MSG
  125.     DECLARE_MESSAGE_MAP()
  126. };
  127.  
  128. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  129. {
  130.     //{{AFX_DATA_INIT(CAboutDlg)
  131.     //}}AFX_DATA_INIT
  132. }
  133.  
  134. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  135. {
  136.     CDialog::DoDataExchange(pDX);
  137.     //{{AFX_DATA_MAP(CAboutDlg)
  138.     //}}AFX_DATA_MAP
  139. }
  140.  
  141. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  142.     //{{AFX_MSG_MAP(CAboutDlg)
  143.         // No message handlers
  144.     //}}AFX_MSG_MAP
  145. END_MESSAGE_MAP()
  146.  
  147. // App command to run the dialog
  148. void CSimpleEditMFCApp::OnAppAbout()
  149. {
  150.     CAboutDlg aboutDlg;
  151.     aboutDlg.DoModal();
  152. }
  153.  
  154.